<style scoped>
    .layui-row {
        overflow: hidden;
    }
    .select-item {
        float: left;
        width: 100%;
        height: auto !important;
        word-break:break-all;
    }
    .layui-row:after, .layui-row:before {
        clear: none;
    }
    .layui-form >>> .layui-form-select{
        z-index: inherit;
    }
    .department >>> .layui-table td, .layui-table th {
        padding: 9px 2px;
        /*white-space: nowrap;*/
    }
    select{
        color: #eee
    }
    option{
        color: #000;
    }
    .layui-inline {
        padding: 5px 0;
    }
    .layui-colla-content {
        border-top: none;
    }
    .layui-colla-title {
        background: none;
        padding-left: 15px !important;
        height: auto;
    }
    .department >>> .layui-colla-icon {
        left: auto;
        right: 15px !important;
    }
    .layui-collapse {
        border: 0 !important;
    }
    /*.department {*/
    /*    position: relative;*/
    /*}*/
    .openicon {
        position: absolute;
        right: 15px;
        top: 10px;
        z-index: 100000;
        border-radius: 50%;
        color: #fff;
        width: 24px;
        text-align: center;
        height: 24px;
        line-height: 24px;
        background: rgba(0,150,136, 0.7);
    }
    .nodata {
        background: #f2f2f2;
        color: #333;
        text-align: center;
        padding: 5px 0;
    }
    .layui-table td p, .layui-table td .rj-cell {
        padding: 3px 0;
    }
    .layui-table td {
        text-align: left !important;
    }

    .rj-wrap {
        font-size: 0;
        width: 100%;
        padding: 0 10px;
        display: flex;
    }
    .cont-left {
        width: 73%;
        display: inline-block;
        font-size: 14px;
        padding: 10px;
    }
    .cont-right {
        width: 27%;
        display: inline-block;
        font-size: 14px;
        padding: 10px;
    }
    .cont-tit {
        font-size: 12px;
        padding: 5px 10px;
        color: #bbb;
    }
    .cont-box {
        background: #fff;
        margin: 10px 0;
    }
    .rj-cell {
        display: inline-block;
        padding: 5px 10px;
    }
    .attachimg {
        width: 80px;
        padding: 5px 10px;
        height: 80px;
    }
    .attachimg:hover {
        cursor: pointer;
    }

    .layui-elem-field legend.btns {
        position: absolute;
        right: 20px;
        top: -2px;
    }
</style>

<template>
    <div class="department">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>订单详情</legend>
        </fieldset>
        <div class="rj-wrap">
            <div class="cont-left" id="viewSell">
                <div class="cont-box" style="margin-top: 5px;">
                    <p class="cont-tit">基础信息</p>
                    <div>
                        <div class="rj-cell max"><label>订单编号：</label><span>{{sellform.sellcode}}</span></div>
                        <div class="rj-cell max"><label>申请人：</label><span>{{sellform.applyname}}</span> <span>{{sellform.depname}}</span></div>
                        <div class="rj-cell"><label>订单类型：</label><span>{{sellform.flagname}}</span><span>{{sellform.flag == 3 ? '[' + sellform.parentcode + ']' : ''}}</span></div>
                    </div>
                    <div>
                        <div class="rj-cell"><label>客户：</label><span>{{sellform.customername}}</span> <span v-if="customer != null">{{customer.typename}}</span></div>
                        <div class="rj-cell"><label>付款方式：</label><span>{{sellform.paytypename}}</span></div>
                        <div class="rj-cell"><label>配送方式：</label><span>{{sellform.deliverytypename}}</span></div>
                        <div class="rj-cell"><label>结算币种：</label><span>{{sellform.currency == 2 ? '美元' : '人民币'}}</span></div>
                    </div>
                    <div>
                        <div class="rj-cell"><label>货品类型：</label><span>{{sellform.quitSRTypeName}}</span></div>
                        <div class="rj-cell" v-if="sellform.settletype == 1"><label>订单件数：</label><span>{{sellform.orderpack}}</span></div>
                        <div class="rj-cell" v-if="sellform.settletype == 1 && sellform.handselcount != ''"><label>赠送件数：</label><span>{{sellform.handselcount}}</span></div>
                        <div class="rj-cell"><label>订单重量：</label><span>{{sellform.orderweight}}</span></div>
                        <div class="rj-cell" v-if="sellform.handselweight != ''"><label>赠送重量：</label><span>{{sellform.handselweight}}</span></div>
                    </div>
                    <div>
                        <div class="rj-cell"><label>要求发货日期：</label><span>{{wlinfo.senddate}}</span></div>
                        <div class="rj-cell"><label>要求到货日期：</label><span>{{wlinfo.arrivedate}}</span></div>
                    </div>
                    <div class="rj-cell"><label>状态：</label><span>{{sellform.statusname}}</span></div>
                    <div class="rj-cell"><label>备注：</label><span>{{sellform.remarks}}</span></div>
                    <div class="rj-cell"><label>创建时间：</label><span>{{sellform.createtime}}</span></div>
                    <div class="rj-cell" v-if="orderfiles.length > 0"><label>附件：</label>
                        <a target="_blank" v-for="(item, index) in orderfiles" :href="item.url" style="padding: 0 5px;">
                            <span>{{item.filename}}</span>
                        </a>
                    </div>
                </div>
                <div class="cont-box">
                    <p class="cont-tit">货运路线</p>
                    <div>
                        <div class="rj-cell">
                            <label>发货地址：</label>
                            <span>{{wlinfo.deliprovince + wlinfo.delicity + wlinfo.delidistrict + wlinfo.deliaddress}}</span>
                        </div>
                        <div class="rj-cell">
                            <label>发货联系人：</label>
                            <span>{{wlinfo.delicontact}}</span>
                            <span>{{wlinfo.delicontacttel}}</span>
                        </div>
                    </div>
                    <div class="rj-cell">
                        <label>收货地址：</label>
                        <span>{{wlinfo.arriprovince + wlinfo.arricity + wlinfo.arridistrict + wlinfo.arriaddres}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>收货联系人：</label>
                        <span>{{wlinfo.arricontact}}</span>
                        <span>{{wlinfo.arricontactno}}</span>
                    </div>
                </div>
                <div class="cont-box" v-if="wlinfo1 != ''">
                    <p class="cont-tit">陆运信息</p>
                    <div class="rj-cell">
                        <label>承运人：</label>
                        <span>{{wlinfo1.carcode}}</span>
                        <span>{{wlinfo1.drivername}}</span>
                        <span>{{wlinfo1.driverphone}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>物流公司：</label>
                        <span>{{wlinfo1.customername}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>车型：</label>
                        <span>{{wlinfo1.carType}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>装车时间：</label>
                        <span>{{wlinfo1.loadtime}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>卸货时间：</label>
                        <span>{{wlinfo1.unloadtime}}</span>
                    </div>
                </div>
                <div class="cont-box" v-if="wlinfo2 != ''">
                    <p class="cont-tit">
                        海运信息
                        <a :href="'/sales/Sellform!exportDCWTS.action?orderid=' + sellform.guid" style="">打印订舱委托书 >></a>
                    </p>
                    <div class="rj-cell">
                        <label>物流公司：</label>
                        <span>{{wlinfo2.customername}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>运输方式：</label>
                        <span>{{sellform.transTypeName}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>货柜号：</label>
                        <span>{{wlinfo2.containerNo}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>发货港口：</label>
                        <span>{{wlinfo2.deliPort}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>收货港口：</label>
                        <span>{{wlinfo2.arriPort}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>收货港所属国家：</label>
                        <span>{{wlinfo2.arriPortCountry}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>海运环境：</label>
                        <span>{{wlinfo2.environment}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>提单类型：</label>
                        <span>{{wlinfo2.lifttypename}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>贸易条款：</label>
                        <span>{{wlinfo2.transClause}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>货运船公司：</label>
                        <span>{{wlinfo2.shipCompany}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>船名称：</label>
                        <span>{{wlinfo2.shipname}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>航次：</label>
                        <span>{{wlinfo2.shipCode}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>提单号：</label>
                        <span>{{wlinfo2.liftCode}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>箱型：</label>
                        <span>{{wlinfo2.boxType}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>箱数：</label>
                        <span>{{wlinfo2.boxSize}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>开船日期：</label>
                        <span>{{wlinfo2.loadtime}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>集装箱号：</label>
                        <span>{{wlinfo2.boxCode}}</span>
                    </div>
                    <div class="rj-cell">
                        <label>备注：</label>
                        <span>{{wlinfo2.remark}}</span>
                    </div>
                </div>
                <div class="cont-box" v-if="wlinfo3 != ''">
                    <p class="cont-tit">物流信息</p>
                    <div class="rj-cell">
                        <label>快递公司：</label>
                        <span>{{wlinfo3.customername}}</span>
                    </div>
                </div>
                <div class="cont-box">
                    <p class="cont-tit">货品信息</p>
                    <div v-for="(item, index) in allItems" :key="item.guid" style="margin-bottom: 5px;">
                        <div>
                            <div class="rj-cell">
                                <label>品种：</label>
                                <span>{{item.productname}}</span>
                            </div>
                            <div class="rj-cell">
                                <label>规格：</label>
                                <span>{{item.spname}}</span>
                            </div>
                        </div>
                        <div class="rj-cell" v-if="sellform.settletype == 1">
                            <label>订单件数：</label>
                            <span>{{item.orderpack}} {{item.unit}}</span>
                        </div>
                        <div class="rj-cell" v-if="sellform.settletype == 1 && item.handselcount != ''">
                            <label>赠送件数：</label>
                            <span>{{item.handselcount}} {{item.unit}}</span>
                        </div>
                        <div class="rj-cell" v-if="sellform.settletype == 2 && item.weight != undefined">
                            <label>订单数量：</label>
                            <span>{{item.weight}} {{item.unit}}</span>
                        </div>
                        <div class="rj-cell" v-if="sellform.settletype == 2 && item.handselweight != ''">
                            <label>赠送数量：</label>
                            <span>{{item.handselweight}} {{item.unit}}</span>
                        </div>
                        <div class="rj-cell" v-if="item.weight != '' && item.weight != undefined">
                            <label>订单重量：</label>
                            <span>{{item.weight}} {{item.stockunit}}</span>
                        </div>
                        <div class="rj-cell" v-if="item.handselweight != '' && item.handselweight != undefined">
                            <label>赠送重量：</label>
                            <span>{{item.handselweight}}  {{item.stockunit}}</span>
                        </div>
                        <template v-if="sellform.status >= 60 && permission.permis.indexOf(7) > -1">
                            <div class="rj-cell">
                                <label>到货净重：</label>
                                <span>{{item.unloadweight}} 吨</span>
                            </div>
                            <div class="rj-cell">
                                <label>包装重量：</label>
                                <span>{{item.packweight}} kg</span>
                            </div>
                            <div class="rj-cell">
                                <label>扣杂率：</label>
                                <span>{{item.deductrate}}</span>
                            </div>
                        </template>
                        <div>
                            <div class="rj-cell">
                                <label>备注信息：</label>
                                <span>{{item.remark}}</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="cont-box" v-if="sellform.status >= 45">
                    <p class="cont-tit">出库信息</p>
                    <template v-if="sellform.settletype == 1">
<!--                        <div class="rj-cell max">-->
<!--                            <label>出库件数：</label>-->
<!--                            <span>{{sellform.loadcount}}</span>-->
<!--                        </div>-->
<!--                        <div class="rj-cell max">-->
<!--                            <label>赠送件数：</label>-->
<!--                            <span>{{sellform.handselcount != '' ? sellform.handselcount : ''}}</span>-->
<!--                        </div>-->
                        <div class="outitems">
                            <div class="rj-cell " v-for="(product, index) in allItems">
                                <span v-if="index == 0">出库/赠送(明细)：</span>
                                <span>{{product.productname}} {{product.spname}}</span>
                                <span style="float: right;padding-left: 5px;">{{product.loadcount != '' ? product.loadcount : 0}}/{{product.handselcount != '' ? product.handselcount : 0}} {{product.unit}}</span>
                            </div>
                        </div>
                    </template>
                    <template v-if="sellform.settletype == 2">
                        <div class="rj-cell max">
                            <label>出库重量：</label>
                            <span>{{sellform.loadweight}} 吨</span>
                        </div>
                        <div class="outitems">
                            <div class="rj-cell " v-for="(product, index) in allItems">
                                <span v-if="index == 0">出库明细：</span>
                                <span>{{product.productname}} {{product.spname}}</span>
                                <span style="float: right;padding-left: 5px;">{{product.loadweight != '' ? product.loadweight : 0}} {{product.unit}}</span>
                            </div>
                        </div>
                    </template>
<!--                    <div class="rj-cell" v-if="JSON.stringify(unLoadWeightL) != '{}'">-->
<!--                        <label>净重：</label>-->
<!--                        <span>{{unLoadWeightL.weight + " 吨"}}</span>-->
<!--                    </div>-->
<!--                    <div class="rj-cell" v-if="JSON.stringify(unLoadWeightL) != '{}'">-->
<!--                        <label>损耗：</label>-->
<!--                        <span>{{sellform.shWeight + " 吨"}}</span>-->
<!--                    </div>-->
<!--                    <div v-if="JSON.stringify(loadWeightL) != '{}'">-->
<!--                        <p style="font-size: 12px;color: #999;padding: 5px 10px;">发货过磅单:</p>-->
<!--                        <div class="rj-cell">-->
<!--                            <label>净重：</label>-->
<!--                            <span>{{loadWeightL.weight}} 吨</span>-->
<!--                        </div>-->
<!--                        <div class="rj-cell">-->
<!--                            <label>过磅人：</label>-->
<!--                            <span>{{loadWeightL.operName}}</span>-->
<!--                        </div>-->
<!--                        <div class="rj-cell">-->
<!--                            <label>过磅时间：</label>-->
<!--                            <span>{{loadWeightL.createtime}}</span>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <div class="weui-media-box weui-media-box_text uploaderFiles" v-if="JSON.stringify(loadWeightL) != '{}' && loadWeightL.imgs.length > 0">-->
<!--                        <p class="exp" style="font-size: 12px;color: #999;padding: 5px 10px;">拉货过磅单:</p>-->
<!--                        <div class="exp uploaderFiles" style="display: inline-block;">-->
<!--                            <viewer :images="sellform.whoutform[0].imgs">-->
<!--                                <img class="attachimg" style="padding-right: 5px;" v-for="(image, indx) in sellform.whoutform[0].imgs" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/common/image/pic.png';this.onerror = null" :src="image.url + '.png'" >-->
<!--                            </viewer>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <div class="weui-media-box weui-media-box_text uploaderFiles" v-if="sellform.whoutform.length >0 && sellform.whoutform[0].imgs.length > 0">-->
<!--                        <p class="exp" style="font-size: 12px;color: #999;padding: 5px 10px;">出库单:</p>-->
<!--                        <div class="exp uploaderFiles" style="display: inline-block;">-->
<!--                            <viewer :images="sellform.whoutform[0].imgs">-->
<!--                                <img class="attachimg" style="padding-right: 5px;" v-for="(image, index) in sellform.whoutform[0].imgs" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/common/image/pic.png';this.onerror = null" :src="image.url + '.png'" >-->
<!--                            </viewer>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <p style="font-size: 12px;color: #999;padding: 5px 10px;" v-show="JSON.stringify(unLoadWeightL) != '{}'">卸货过磅单:</p>-->
<!--                    <div v-show="JSON.stringify(unLoadWeightL) != '{}'">-->
<!--                        <div class="rj-cell">-->
<!--                            <label>净重：</label>-->
<!--                            <span>{{unLoadWeightL.weight}} 吨</span>-->
<!--                        </div>-->
<!--                        <div class="rj-cell">-->
<!--                            <label>过磅人：</label>-->
<!--                            <span>{{unLoadWeightL.operName}}</span>-->
<!--                        </div>-->
<!--                        <div class="rj-cell">-->
<!--                            <label>过磅时间：</label>-->
<!--                            <span>{{unLoadWeightL.createtime}}</span>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <div class="weui-media-box weui-media-box_text uploaderFiles" v-if="JSON.stringify(unLoadWeightL) != '{}' && unLoadWeightL.imgs.length > 0">-->
<!--                        <p class="exp" style="font-size: 12px;color: #999;padding: 5px 10px;">拉货过磅单:</p>-->
<!--                        <div class="exp uploaderFiles" style="display: inline-block;">-->
<!--                            <viewer :images="sellform.whoutform[0].imgs">-->
<!--                                <img class="attachimg" style="padding-right: 5px;" v-for="(image, index) in sellform.whoutform[0].imgs" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/common/image/pic.png';this.onerror = null" :src="image.url + '.png'" >-->
<!--                            </viewer>-->
<!--                        </div>-->
<!--                    </div>-->
                </div>
<!--                <div class="cont-box" v-if="qaform.qacode != '' && qaform.qacode != null">-->
<!--                    <p class="cont-tit">质检信息</p>-->
<!--                    <div  >-->
<!--                        <div class="rj-cell max">-->
<!--                            <label><span style="font-size: 14px;padding: 0;">质检单编号：</span></label>-->
<!--                            <span>{{qaform.qacode}}</span>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <div class="rj-cell max">-->
<!--                        <label>抽检数量：</label>-->
<!--                        <span>{{qaform.chkpknum}} 包</span>-->
<!--                        <span> {{qaform.chkwght}} Kg</span>-->

<!--                        <label>合格重量：</label>-->
<!--                        <span> {{qaform.okweight}} Kg</span>-->
<!--                    </div>-->
<!--                    <div class="rj-cell max">-->
<!--                        <label>不合格重量：</label>-->
<!--                        <span> {{qaform.notokweight}} Kg</span>-->
<!--                        <label>不合格率：</label>-->
<!--                        <span> {{qaform.unqualifiedchkrate}}%</span>-->
<!--                    </div>-->
<!--                    <div class="rj-cell max">-->
<!--                        <label>土杂重量：</label>-->
<!--                        <span> {{qaform.soilchkweight}} Kg</span>-->
<!--                        <label>土杂率：</label>-->
<!--                        <span> {{qaform.soilchkrate}}%</span>-->
<!--                    </div>-->
<!--                    <div class="rj-cell max">-->
<!--                        <label>合格率：</label>-->
<!--                        <span> {{Number((100-qaform.deductrate)).toFixed(2)}} %</span>-->
<!--                    </div>-->
<!--                    <div class="rj-cell max">-->
<!--                        <label>质检人：</label>-->
<!--                        <span>{{qaform.operatorname}}</span>-->
<!--                        <label>质检时间：</label>-->
<!--                        <span>{{qaform.createdate}}</span>-->
<!--                    </div>-->
<!--                    <div class="weui-media-box weui-media-box_text uploaderFiles" v-if="qaFormImg != undefined && qaFormImg.length > 0">-->
<!--                        <p class="exp" style="font-size: 12px;color: #999;padding: 5px 10px;">质检单照片:</p>-->
<!--                        <div class="exp uploaderFiles" style="display: inline-block;">-->
<!--                            <viewer :images="sellform.whoutform[0].imgs">-->
<!--                                <img class="attachimg" style="padding-right: 5px;" v-for="(image, index) in sellform.whoutform[0].imgs" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/common/image/pic.png';this.onerror = null" :src="image.url + '.png'" >-->
<!--                            </viewer>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
                <div class="cont-box" v-if="sellform.finalamount != ''">
                    <p class="cont-tit">结算信息</p>
                    <div class="rj-cell max">
                        <label>结算金额：</label>
                        <span>{{sellform.finalamount}}</span>
                    </div>
                    <div v-for="(item, index) in sellitems" :key="item.guid">
                        <div>
                            <div class="rj-cell">
                                <label>品种：</label>
                                <span>{{item.productname}}</span>
                            </div>
                            <div class="rj-cell">
                                <label>规格：</label>
                                <span>{{item.spname}}</span>
                            </div>
                            <div class="rj-cell">
                                <label>单价：</label>
                                <span>{{item.price}} {{sellform.settletype == 1 ? packUnit(item.unit, sellform.currency) : sellform.currency == 2 ? '美元/吨' : '元/吨'}}</span>
                            </div>
                        </div>
<!--                        <div class="rj-cell" v-if="sellform.settletype == 1">-->
<!--                            <label>出库数量：</label>-->
<!--                            <span>{{item.loadcount}} {{item.unit}}</span>-->
<!--                        </div>-->
                        <div class="rj-cell" v-if="sellform.settletype == 1">
                            <label>结算数量：</label>
                            <span>{{item.settlecount}} {{item.unit}}</span>
                        </div>
<!--                        <div class="rj-cell" v-if="sellform.settletype == 1 && item.handselcount != ''">-->
<!--                            <label>赠送件数：</label>-->
<!--                            <span>{{item.handselcount}} {{item.unit}}</span>-->
<!--                        </div>-->
<!--                        <div class="rj-cell" v-if="sellform.settletype == 2">-->
<!--                            <label>出库重量：</label>-->
<!--                            <span>{{item.loadweight}} 吨</span>-->
<!--                        </div>-->
                        <div class="rj-cell" v-if="sellform.settletype == 2">
                            <label>结算重量：</label>
                            <span>{{item.settleweight}} 吨</span>
                        </div>
<!--                        <div class="rj-cell" v-if="sellform.settletype == 2 && item.handselweight != ''">-->
<!--                            <label>赠送重量：</label>-->
<!--                            <span>{{item.handselweight}} 吨</span>-->
<!--                        </div>-->
                        <div class="rj-cell">
                            <label>结算金额：</label>
                            <span>{{item.settleamount}}</span>
                        </div>
                        <div class="rj-cell">
                            <label>回款金额：</label>
                            <span>{{sellform.backmoney}}</span>
                        </div>
                    </div>
                </div>
                <div class="cont-box" v-if="backinfo != ''">
                    <p class="cont-tit">退换货信息</p>
                    <div>
                        <div class="rj-cell">
                            <label>退货类型：</label>
                            <span>{{backinfo.typename}}</span>
                        </div>
                        <template v-if="backinfo.type == 1">
                            <div class="rj-cell">
                                <label>退款金额：</label>
                                <span>{{backinfo.amount}}</span>
                            </div>
                            <div class="rj-cell">
                                <label>收款人：</label>
                                <span>{{backinfo.payee}}</span>
                            </div>
                            <div class="rj-cell">
                                <label>开户行：</label>
                                <span>{{backinfo.bank}}</span>
                            </div>
                            <div class="rj-cell">
                                <label>收款账号：</label>
                                <span>{{backinfo.bankaccount}}</span>
                            </div>
                        </template>
                        <template v-if="backinfo.type == 3">
                            <div class="rj-cell">
                                <label>补货金额：</label>
                                <span>{{backinfo.amount}}</span>
                            </div>
                            <div class="rj-cell">
                                <label>收款人：</label>
                                <span>{{backinfo.customername}}</span>
                            </div>
                        </template>
                        <div v-if="backinfo.type == 1 || backinfo.type == 3" class="rj-cell">
                            <label>付款方式：</label>
                            <span>{{backinfo.paytypename}}</span>
                        </div>
                        <div class="rj-cell">
                            <label>状态：</label>
                            <span>{{backinfo.statusname}}</span>
                        </div>
                    </div>
                </div>

            </div>
            <div class="cont-right">
                <SalesOperationLogs2 v-if="sellform.flag == 3" :orderid="id" :srguid="sellform.storermguid" :departid="sellform.depguid"></SalesOperationLogs2>
                <SalesOperationLogs2 v-else :orderid="id" :srguid="sellform.storermguid" :departid="sellform.depguid" :sellformpid="sellform.parentguid" :sellformpcode="sellform.parentcode"></SalesOperationLogs2>
            </div>
        </div>

    </div>
</template>

<script>
    import SalesOperationLogs2 from '../common/SalesOperationLogs2'

    // import 'viewerjs/dist/viewer.css'
    // import Viewer from 'v-viewer'
    // import Vue from 'vue'
    // Vue.use(Viewer)

    let qs = require('qs');
    export default {
        name: 'ViewSellform',
        props: ['id'],
        data () {
            return {
                guid : this.id,
                sellform: '',
                wlinfos: {},
                wlinfo: '',
                wlinfo1: '',
                wlinfo2: '',
                wlinfo3: '',
                sellitems: [],
                customer: '',
                hasWeightList: false,
                loadWeightL: {},
                unLoadWeightL: {},
                qaform:[],
                qaFormImg:[],
                orderfiles: [],
                permission: JSON.parse(sessionStorage.getItem('permissions')),
                backinfo: '',
                allItems: ''
            }
        },
        components: {
            SalesOperationLogs2
        },
        mounted() {
            let that = this;
            this.getOrder(this.guid);
            this.getFiles();
        },
        methods: {
            packUnit: function(unit, currency) {
                return unit != undefined && unit != '' ? currency == 2 ? '美元/' : '元/' + unit : '';
            },
            getFiles: function() {
                let that = this;
                this.axios({
                    method: 'get',
                    url: '/sales/Fileinfo!getFileinfo.action',
                    params: {orderid: this.id}
                }).then(response => {

                    if (response.data.msg == 'success') {
                        this.orderfiles = response.data.files;
                    } else {
                        //失败时不提示
                    }
                });
            },
            getOrder: function (id) {
                let that = this;
                this.axios({
                    method: 'get',
                    url: '/sales/Sellform!detail.action',
                    params: {orderid: id}
                }).then(response => {
                    if (response.data.status == 'true') {
                        let res = response.data.result;
                        this.sellform = res;
                        this.sellitems = res.items;
                        this.allItems = this.sellform.spitems.concat(this.sellitems)
                        this.customer = res.customer;
                        this.wlinfo = response.data.wlinfoaddress;
                        response.data.wlinfos.map(function (item) {
                            if (item.transtype == 1) {
                                that.wlinfo1 = item;
                            } else if (item.transtype == 2) {
                                that.wlinfo2 = item;
                            } else if (item.transtype == 3) {
                                that.wlinfo3 = item;
                            }
                        });

                        let weightLst = res.weightlist;

                        this.hasWeightList = weightLst.length > 0 ? true : false;
                        /**
                         2020-3-23
                         liukx
                         销售订单详情添加质检信息
                         */
                        let data = response.data;
                        this.qaform = data.qaForm != null ? data.qaForm : {};
                        this.qaFormImg = data.qaFormImg;

                        for (let i=0; i<weightLst.length; i++) {
                            switch (weightLst[i].wtype) {
                                case 1:
                                    this.loadWeightL = weightLst[i];
                                    break;
                                case 2:
                                    this.unLoadWeightL = weightLst[i];
                                    break;
                            }
                        }
                        //退换货信息
                        this.backinfo = res.backinfo[0] || '';
                    } else if (response.data.status == 'true') {
                        this.toastError(response.data.result);
                    } else {
                        this.toastError('系统错误');
                    }
                });
            }
        }
    }
</script>
